package cn.yuanqiao.common.constant;

import io.jsonwebtoken.Claims;

import java.util.HashMap;
import java.util.Map;

/**
 * 通用常量信息
 * 
 * @author ruoyi
 */
public class Constants
{
    /**
     * UTF-8 字符集
     */
    public static final String UTF8 = "UTF-8";

    /**
     * GBK 字符集
     */
    public static final String GBK = "GBK";

    /**
     * www主域
     */
    public static final String WWW = "www.";

    /**
     * http请求
     */
    public static final String HTTP = "http://";

    /**
     * https请求
     */
    public static final String HTTPS = "https://";

    /**
     * 通用成功标识
     */
    public static final String SUCCESS = "0";

    /**
     * 通用失败标识
     */
    public static final String FAIL = "1";

    /**
     * 登录成功
     */
    public static final String LOGIN_SUCCESS = "Success";

    /**
     * 登录成功状态
     */
    public static final String LOGIN_SUCCESS_STATUS = "0";

    /**
     * 登录失败状态
     */
    public static final String LOGIN_FAIL_STATUS = "1";

    /**
     * 注销
     */
    public static final String LOGOUT = "Logout";

    /**
     * 注册
     */
    public static final String REGISTER = "Register";

    /**
     * 登录失败
     */
    public static final String LOGIN_FAIL = "Error";

    /**
     * 所有权限标识
     */
    public static final String ALL_PERMISSION = "*:*:*";

    /**
     * 管理员角色权限标识
     */
    public static final String SUPER_ADMIN = "admin";

    /**
     * 角色权限分隔符
     */
    public static final String ROLE_DELIMETER = ",";

    /**
     * 权限标识分隔符
     */
    public static final String PERMISSION_DELIMETER = ",";

    /**
     * 验证码有效期（分钟）
     */
    public static final Integer CAPTCHA_EXPIRATION = 2;

    /**
     * 令牌
     */
    public static final String TOKEN = "token";

    /**
     * 令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";

    /**
     * 令牌前缀
     */
    public static final String LOGIN_USER_KEY = "login_user_key";

    /**
     * 用户ID
     */
    public static final String JWT_USERID = "userid";

    /**
     * 用户名称
     */
    public static final String JWT_USERNAME = Claims.SUBJECT;

    /**
     * 用户头像
     */
    public static final String JWT_AVATAR = "avatar";

    /**
     * 创建时间
     */
    public static final String JWT_CREATED = "created";

    /**
     * 用户权限
     */
    public static final String JWT_AUTHORITIES = "authorities";

    /**
     * 资源映射路径 前缀
     */
    public static final String RESOURCE_PREFIX = "/profile";

    /**
     * RMI 远程方法调用
     */
    public static final String LOOKUP_RMI = "rmi:";

    /**
     * LDAP 远程方法调用
     */
    public static final String LOOKUP_LDAP = "ldap:";

    /**
     * LDAPS 远程方法调用
     */
    public static final String LOOKUP_LDAPS = "ldaps:";

    /**
     * 自动识别json对象白名单配置（仅允许解析的包名，范围越小越安全）
     */
    public static final String[] JSON_WHITELIST_STR = { "org.springframework", "cn.yuanqiao" };

    /**
     * 定时任务白名单配置（仅允许访问的包名，如其他需要可以自行添加）
     */
    public static final String[] JOB_WHITELIST_STR = { "cn.yuanqiao" };

    /**
     * 定时任务违规的字符
     */
    public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
            "org.springframework", "org.apache", "cn.yuanqiao.common.utils.file", "cn.yuanqiao.common.config", "cn.yuanqiao.generator" };

    /**
     * 业务档案门类数据库表拼接
     */
    public static final String BIG_TABLE_NAME = "_CATEGORY";
    /**
     * 档案树
     */
    public static final String BIG_TABLE_NAME_TREES = "_TREES";
    /**
     * 档案树和角色
     */
    public static final String BIG_TABLE_NAME_TREESROLE = "_TREESROLE";

    /**
     * 卷-件关联表拼接参数
     */
    public static final String BIG_TABLE_FOLDER_NAME = "_YQDA_FOLDER";

    /**
     * 项目-卷关联拼接参数
     */
    public static final String BIG_TABLE_NAME_ITEM = "_ITEM_FOLDER";

    /**
     * 元数据表名拼接
     */
    public static final String BIG_TABLE_M_DATA_LIST = "_MDATA_LIST";

    /**
     * 件总表拼接
     */
    public static final String BIG_TABLE_YQDA = "_YQDA";

    /**
     * 卷总表拼接
     */
    public static final String BIG_TABLE_YQFOLDER = "_YQFOLDER";

    /**
     * 项目总表拼接
     */
    public static final String BIG_TABLE_YQITEM = "_YQITEM";

    /**
     * 专题表
     */
    public static final String TABLE_YQ_ZHUAN_TI = "_YQZHUANTI";

    /**
     * 专题内容
     */
    public static final String TABLE_YQ_ZHUAN_TI_BLOB = "_YQZHAUNTIBLOB";

    /**
     * 资料资源个人库
     */
    public static final String TABLE_YQ_DATA_GEREN_KU = "_YQ_DATA_GEREN_KU";

    /**
     * 专题个人中间表
     */
    public static final String TABLE_YQ_ZHUANTI_GEREN_DATA = "_YQ_DATA_ZHUANTI_GERN";

    /**
     * 专题成果
     */
    public static final String TABLE_YQ_ZHUANTI_CHENGUO = "_YQ_ZHUANTI_CHENGGUO";

    /**
     * 专题成果W文件表
     */
    public static final String TABLE_YQ_ZTCG_FILE = "_YQ_ZTCG_FILE";

    /**
     * 应用定义表名
     */
    public static final String TABLE_YQ_APP = "_APPLY";

    /**
     * 档案树
     */
    public static final String ABLE_TREES = "_TREES";

    /**
     * 档案树授权
     */
    public static final String ABLE_TREES_ROLE = "_TREESROLE";

    /**
     * 登录用户编号 redis key
     */
    public static final String LOGIN_USERID_KEY = "login_userid:";

    /**
     * 新建查询索引
     */
    public static final Integer DEFAULT_PAGESIZE = 20;

    public static Map<String, Boolean> TenantInit = new HashMap<>();
}
